1. Technical Field
This invention relates to computer software. More particularly, it relates to rule-based expert systems such as those which exhibit artificial intelligence.
2. Description of the Prior Art
Expert systems are widely used to program computers to show artificial intelligence. These systems are considered declarative programs as opposed to procedural programs since they describe intended results, rather than prescribe procedures for obtaining results. Expert systems include forward-chaining systems for drawing conclusions from data using rules, and backward-chaining systems for achieving goals by applying rules to data. A forward-chaining production system consists of rules, data, and a control program. A backward-chaining system further includes one or more goals.
Rules, also known as "productions", are statements of the form "IF condition, THEN action". They represent the knowledge in a production system. The condition part of a rule states one or more facts that must be true for the rule to be applied. The action part states the actions to be taken when the rule is applied. The data represent the facts in a production system.
The control program is a procedure for applying the rules to the data. It operates by repeatedly executing the control cycle. The control cycle is composed of a number of phases, the exact number and nature of which vary depending upon the control program. Classically, the control cycle of a forward-chaining system includes three phases.
Phase 1 of the forward-chaining control cycle selects the set of eligible-to-fire rule instantiations from the set of all rule instantiations. This phase is based in part on which rules match the data. A rule matches the data when all of its stated conditions are true with respect to the data. A rule may match the data in more than one way. Each way is called an "instantiation" of the rule. This, an instantiation is a combination of a rule and matching data.
The set of eligible-to-fire rule instantiations is all the rule instantiations that have not been fired. The set of eligible-to-fire rule instantiations is given the colorful name "conflict set" because of the conflict involved in selecting only one of the eligible-to-fire instantiations to be fired.
Phase 2 selects the next rule instantiation to be fired from the set of eligible-to-fire rule instantiations. This phase is based in part on a conflict resolution procedure which selects one rule instantiation to fire if more than one rule instantiation is eligible to fire. The exact criteria used to select the next rule instantiation to be fired may vary from one conflict resolution procedure to another.
In Phase 3, the selected rule instantiation is fired. "Firing" an instantiation (or rule) means that the actions specified in the action part of the rule are carried out (executed). The firing typically modifies (creates, updates or deletes) data in the instantiation, which in turn affects which rules are eligible to fire in the next control cycle. The control cycle is repeated until no rules are eligible to fire.
The firing of rules is analogous to the human reasoning process of drawing deductive conclusions by applying rules to sets of facts. The conclusions drawn may act as additional facts to which other rules are applied to draw additional conclusions. The reasoning process continues until no new additional conclusions can be drawn.
There is a need for an easy-to-use debugger for expert systems. A debugger is a computer program which implements a method of debugging or finding and correcting errors in another "target" computer program. The task of debugging, or finding and correcting errors in a system, is based on being able to observe the behavior of the system. A debugger coordinates the display of information, interpretation of user commands, and execution of the target program.
An easy-to-use debugger for an expert system should allow a single command to both execute the control cycle and automatically display relevant information. At present, users must learn and use a variety of different commands to execute the control cycle and display relevant information.
The debugger should allow the user to observe each rule instantiation before it is fired. This "prefire" information allows the user to determine whether the correct instantiation is selected to be fired. To determine whether the instantiation is correct, the user needs to see the conflict set, the text of the rule, and the data in the next instantiation to be fired. These sources of information should be displayed in context with each other. At present, prefire information is not automatically displayed. Users must explicitly request displays of the conflict set and the data via separate commands before each cycle. These displays are written sequentially on the computer screen from top to bottom, and are frequently larger than the screen, making it difficult to keep information of interest visible on the screen at the same time.
The debugger should also allow the user to observe modifications made to the data after an instantiation is fired. This "postfire" information allows the user to determine whether the correct modifications were made to the data. To determine whether correct modifications were made, the user needs to see the modified data in the context of the text of the rule and data in the just-fired instantiation. At present, the automatic display of postfire information must be requested in advance. Also, as described above, postfire displays of modified data and the data in the just-fired instantiation are written sequentially on the computer screen, making it difficult to keep information of interest visible on the screen at the same time.